import React from 'react'
import {Link} from 'react-router-dom';
// import { AuthContext } from './Context';
import {useAuth} from './Context'
import './Header.css';


 const Header = (props) => {
    //  const {isLogin} = useContext(AuthContext) //引入变量
    const {isLogin} = useAuth();
        return (
            <div className='header-wrap'>
                <div className='header'>
                    <img className='logo' src="https://static2.cnodejs.org/public/images/cnodejs_light.svg" alt="" />
                    <div>
                        <Link to='/'>首页</Link>
                        <Link to='/new'>新手入门</Link>
                        <Link to='/api'>API</Link>
                        {/* <Link to='/login'>登录</Link> */}
                        <Link to='/collect'>收藏</Link>
                        <Link to='/user'>个人中心</Link>
                        {isLogin?<button>退出</button>:<Link to='./login'>登录</Link>}
                    </div>
                </div>
                
            </div>
        )
    
}

export default Header
